package com.work.game.home.ui.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.work.game.R;
import com.work.game.home.ui.model.InviteRecord;
import com.work.game.home.ui.model.statistics.RankingList;
import com.work.game.refresh.baseadapter.CommonAdapter;
import com.work.game.refresh.baseadapter.ViewHolder;

import java.util.List;

public class IncomeListAdapter extends BaseAdapter {
    private Context mContext;
    private List<RankingList> mData;

    public IncomeListAdapter(Context context, List<RankingList> data) {
        this.mContext = context;
        this.mData = data;
    }

    @Override
    public int getCount() {
        return mData.size();
    }

    @Override
    public Object getItem(int i) {
        return mData.get(i);
    }

    @Override
    public long getItemId(int i) {
        return i;
    }

    @Override
    public View getView(int i, View convertView, ViewGroup viewGroup) {
        if (convertView == null) {
            convertView = LayoutInflater.from(mContext).inflate(R.layout.item_income, viewGroup, false);
        }
        RankingList rankingList = mData.get(i);
        TextView tvId = convertView.findViewById(R.id.tv_id);
        tvId.setText(rankingList.getIndex());
        TextView userName = convertView.findViewById(R.id.tv_user_name);
        userName.setText(rankingList.getId());
        tvId.setText(rankingList.getIndex());
        TextView tvTime = convertView.findViewById(R.id.tv_time);
        tvTime.setText(rankingList.getMoney());
        if (i % 2 != 0) {
            LinearLayout ll = convertView.findViewById(R.id.ll_invite_record);
            ll.setBackgroundColor(this.mContext.getResources().getColor(R.color.transparent_home));
        }
        return convertView;
    }
}
